// part1:C14:ex14.37.cpp
// class to examine two value are equal.
#include <vector>
#include <algorithm>
class IntCompare
{
public:
    IntCompare(int v): val(v){} 
    bool operator()(int v) { return val == v; }
private:
    int val;
};

int main(void)
{
    using namespace std;
    vector<int> vec = {1, 2, 3, 2, 1};
    const int oldVal = 2;
    const int newVal = 200;
    IntCompare icmp(oldVal);
    std::replace_if(vec.begin(), vec.end(), icmp, newVal);
    return 0;
}
